package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.InsertAutoFill;
import com.sky.annotation.UpdateAutoFill;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     *
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 新增员工信息
     *
     * @param employee
     */
    @InsertAutoFill
    void insert(Employee employee);

    /**
     * 员工分页查询
     *
     * @param name
     * @return
     */
    Page<Employee> selectPage(String name);

    /**
     * 更新员工
     *
     * @param employee
     */
    @UpdateAutoFill
    void update(Employee employee);

    /**
     * 根据ID查询
     *
     * @param id
     * @return
     */
    @Select("select * from employee where id = #{id}")
    Employee selectById(Long id);
}
